@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('heading')
    <h3>
        课程管理
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">课程管理</a>
        </li>
        <li class="active"> 分类新增</li>
    </ul>
@endsection


@section('wrapper')
    <section class="panel">

        <div class="panel-body">
            <div class=" form">
                @if(isset($category))
                    <form method="POST" action="{{ route('category.update', $category->id) }}" class="cmxform form-horizontal adminex-form">
                        {{ method_field('PATCH') }}
                @else
                    <form method="POST" action="{{ route('category.store') }}" class="cmxform form-horizontal adminex-form">
                @endif
                    @csrf
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">名称</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('name') ? ' error' : '' }}" id="cname" value="{{ $category->name or old('name') }}" name="name" minlength="2" type="text"/>
                            @if ($errors->has('name'))
                                <label class="error">{{ $errors->first('name') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button class="btn btn-primary" type="submit">保存</button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </section>
@endsection